<!DOCTYPE html>
<html lang="en">
<style>
    span:nth-of-type(2) {
        display: inline-block;

    }

    input {
        border: none;
        outline: none;
        font-size: 16px
    }

    span:nth-of-type(2),
    input {
        border-bottom: 1px solid black;
        width: 100px;
        text-align: center;
    }
</style>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <fieldset id="app">
        <legend>个人信息</legend>
        <p v-for="item in arr">
            <span>{{item.type}}:</span>
            <span @dblclick="doubleClick(item)" v-if="!item.flag">{{item.value}}</span>
            <input type="text" v-model="item.value" v-if="item.flag" @blur="blurInput(item)" v-focus>
        </p>
    </fieldset>
</body>

</html>

<script src='https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js'></script>
<script>
    Vue.directive("focus", {
        inserted(el, binding) {
            el.focus()
        }
    })
    let vm = new Vue({
        el: "#app",
        data: {
            arr: [
                { type: "姓名", value: "马西梅", flag: false },
                { type: "年龄", value: 18, flag: false },
                { type: "爱好", value: "夏洛", flag: false },
                { type: "身高", value: "150cm", flag: false }
            ]
        },
        methods: {
            doubleClick(item) {
                item.flag = true;
            },
            blurInput(item) {
                item.flag = false;
            }
        }

    })
</script>